<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0079)http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html -->
<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8">

<TITLE>C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园</TITLE><META name="keywords" content="csharp,语法糖,匿名委托,扩展方法">
<META name="description" content="&ldquo;语法糖&rdquo;这个词绝非贬义词，它可以给我带来方便，是一种便捷的写法，编译器会帮我们做转换；而且在性能上也不会带来损失。">
<LINK type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/common.css">
<LINK id="MainCss" type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/style.css">
<LINK type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/common2.css">
<LINK type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/shCore.css">
<LINK type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/shThemeDefault.css">
<LINK type="text/css" rel="stylesheet" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/customcss.aspx">
<LINK title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/yukaizhao/rss">
<LINK title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/yukaizhao/rsd.xml"> 
<SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/jquery.js" type="text/javascript"></SCRIPT>  
<SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/common.js" type="text/javascript"></SCRIPT>
<SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/jquery.json-2.2.min.js" type="text/javascript"></SCRIPT>
</HEAD><BODY>
    <FORM name="Form1" method="post" action="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园.htm" id="Form1">
<DIV>
<INPUT type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="">
<INPUT type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="">
<INPUT type="hidden" name="__VIEWSTATE" id="
__VIEWSTATE" value="">
</DIV>

<SCRIPT type="text/javascript">
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</SCRIPT>


        
<!--done-->
<DIV id="header">
	
<!--done-->
<DIV class="header">
	<DIV class="headerText">
		<A id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/yukaizhao/">欢迎光临赵玉开的技术博客</A><BR>
		.NET技术 Blog .NET c# software 

穷则变，变则通，通则久
	</DIV>
</DIV>

</DIV>
<DIV id="mylinks">
<!--done-->
<A id="MyLinks1_HomeLink" class="menu" href="http://www.cnblogs.com/">博客园</A>&nbsp;&nbsp;&nbsp;
<A id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/yukaizhao/">首页</A>&nbsp;&nbsp;&nbsp;
<A id="MyLinks1_NewPostLink" class="menu" href="http://www.cnblogs.com/yukaizhao/admin/EditPosts.aspx?opt=1">新随笔</A>&nbsp;&nbsp;&nbsp;
<A id="MyLinks1_ContactLink" accesskey="9" class="menu" href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80">联系</A>&nbsp;&nbsp;&nbsp;
<A id="MyLinks1_Syndication" class="menu" href="http://www.cnblogs.com/yukaizhao/rss">订阅</A><A id="MyLinks1_XMLLink" href="http://www.cnblogs.com/yukaizhao/rss"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml.gif" alt="订阅" style="border-width:0px;"></A>&nbsp;&nbsp;&nbsp;
<A id="MyLinks1_Admin" class="menu" href="http://www.cnblogs.com/yukaizhao/admin/EditPosts.aspx">管理</A>
</DIV>
<DIV id="mytopmenu">
	
		
<DIV class="blogStats">随笔 - 249&nbsp;
文章 - 2&nbsp;评论 - 2485&nbsp;trackbacks - 32
</DIV>
	
</DIV>
<DIV id="leftcontent">
	
		<DIV id="leftcontentcontainer">
			<TABLE id="Calendar1_entryCal" class="Cal" cellspacing="0" cellpadding="0" title="Calendar" border="0" style="border-width:1px;border-style:solid;border-collapse:collapse;border:0px">
	<TBODY><TR><TD colspan="7" style="background-color:Transparent;"><TABLE class="CalTitle" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;">
		<TBODY><TR><TD class="CalNextPrev" style="width:15%;"><A href="javascript:__doPostBack('Calendar1$entryCal','V3834')" style="color:Black" title="Go to the previous month">&lt;</A></TD><TD align="center" style="width:70%;">2010年8月</TD><TD class="CalNextPrev" align="right" style="width:15%;"><A href="javascript:__doPostBack('Calendar1$entryCal','V3896')" style="color:Black" title="Go to the next month">&gt;</A></TD></TR>
	</TBODY></TABLE></TD></TR><TR><TH class="CalDayHeader" align="center" abbr="日" scope="col">日</TH><TH class="CalDayHeader" align="center" abbr="一" scope="col">一</TH><TH class="CalDayHeader" align="center" abbr="二" scope="col">二</TH><TH class="CalDayHeader" align="center" abbr="三" scope="col">三</TH><TH class="CalDayHeader" align="center" abbr="四" scope="col">四</TH><TH class="CalDayHeader" align="center" abbr="五" scope="col">五</TH><TH class="CalDayHeader" align="center" abbr="六" scope="col">六</TH></TR><TR><TD class="CalOtherMonthDay" align="center" style="width:14%;">25</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">26</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">27</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">28</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">29</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">30</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">31</TD></TR><TR><TD class="CalWeekendDay" align="center" style="width:14%;">1</TD><TD align="center" style="width:14%;">2</TD><TD align="center" style="width:14%;">3</TD><TD align="center" style="width:14%;">4</TD><TD align="center" style="width:14%;">5</TD><TD align="center" style="width:14%;">6</TD><TD class="CalWeekendDay" align="center" style="width:14%;">7</TD></TR><TR><TD class="CalWeekendDay" align="center" style="width:14%;">8</TD><TD align="center" style="width:14%;">9</TD><TD align="center" style="width:14%;">10</TD><TD class="CalTodayDay" align="center" style="width:14%;">11</TD><TD align="center" style="width:14%;">12</TD><TD align="center" style="width:14%;">13</TD><TD class="CalWeekendDay" align="center" style="width:14%;">14</TD></TR><TR><TD class="CalWeekendDay" align="center" style="width:14%;">15</TD><TD align="center" style="width:14%;">16</TD><TD align="center" style="width:14%;">17</TD><TD align="center" style="width:14%;">18</TD><TD align="center" style="width:14%;">19</TD><TD align="center" style="width:14%;">20</TD><TD class="CalWeekendDay" align="center" style="width:14%;">21</TD></TR><TR><TD class="CalWeekendDay" align="center" style="width:14%;">22</TD><TD align="center" style="width:14%;">23</TD><TD align="center" style="width:14%;">24</TD><TD align="center" style="width:14%;">25</TD><TD align="center" style="width:14%;">26</TD><TD align="center" style="width:14%;">27</TD><TD class="CalWeekendDay" align="center" style="width:14%;">28</TD></TR><TR><TD class="CalWeekendDay" align="center" style="width:14%;">29</TD><TD align="center" style="width:14%;">30</TD><TD align="center" style="width:14%;">31</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">1</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">2</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">3</TD><TD class="CalOtherMonthDay" align="center" style="width:14%;">4</TD></TR>
</TBODY></TABLE>
<BR>
			
<!--done-->
<DIV class="newsItem">
	<DIV align="center"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/y1pYJVfFdp7w21gYHeQdjw5zcE8MBx6YhkxH68CbbLYkaTRq85D-Ddnxv8sIDyNZNTX" border="0">
<BR>
转载请保留链接
</DIV><DIV id="profile_block">粉丝 - 91<BR>关注 - 38<BR><A href="http://home.cnblogs.com/yukaizhao/" target="_blank">我的主页</A>&nbsp; <A href="http://home.cnblogs.com/yukaizhao/detail/" target="_blank">个人资料</A><BR><A href="http://home.cnblogs.com/yukaizhao/ing/" target="_blank">我的闪存</A>&nbsp; <A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" target="_blank">发短消息</A></DIV>
</DIV>

			
<SCRIPT type="text/javascript">
var blogapp = 'yukaizhao';
</SCRIPT>
<DIV class="mySearch">
<H3 class="catListTitle">搜索</H3>

<DIV class="div_my_zzk"><INPUT type="text" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk">&nbsp;<INPUT onclick="zzk_go()" type="button" value="找找看" id="btnZzk" class="btn_my_zzk"></DIV>

</DIV>
<H3>常用链接</H3>
<UL>

		<LI><A id="SingleColumn1_ctl01_rptMainLinks_ctl00_lnkLinkItem" href="http://www.cnblogs.com/yukaizhao/MyPosts.html">我的随笔</A></LI>
	
		<LI><A id="SingleColumn1_ctl01_rptMainLinks_ctl01_lnkLinkItem" href="http://home.cnblogs.com/yukaizhao/">我的空间</A></LI>
	
		<LI><A id="SingleColumn1_ctl01_rptMainLinks_ctl02_lnkLinkItem" href="http://space.cnblogs.com/msg/recent">我的短信</A></LI>
	
		<LI><A id="SingleColumn1_ctl01_rptMainLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/yukaizhao/MyComments.html">我的评论</A></LI>
	
<LI><A id="itemListLink" onclick="this.blur();WarpClass(&#39;itemListLink&#39;, &#39;itemListLin_con&#39;);return false;" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#">更多链接</A></LI>
</UL>
<DIV id="itemListLin_con" style="display:none;">
<UL>
		<LI><A id="SingleColumn1_ctl01_repeaterLinks_ctl01_lnkLinkItem" title="我发表过评论的随笔" href="http://www.cnblogs.com/yukaizhao/OtherPosts.html">我的参与</A></LI>
	
		<LI><A id="SingleColumn1_ctl01_repeaterLinks_ctl02_lnkLinkItem" href="http://www.cnblogs.com/yukaizhao/RecentComments.html">最新评论</A></LI>
	
		<LI><A id="SingleColumn1_ctl01_repeaterLinks_ctl03_lnkLinkItem" href="http://www.cnblogs.com/yukaizhao/tag/">我的标签</A></LI>
	</UL>
</DIV>
<H3 class="catListTitle">我参与的团队</H3>
<DIV class="RecentComment">
	
			<UL style="word-break:break-all">
		
			<LI>
				<A id="SingleColumn1__2b0c737_TeamList_ctl01_lnkTeam" href="http://www.cnblogs.com/team/BPMDotNet/">.Net流程管理系统联盟(0/0)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__2b0c737_TeamList_ctl02_lnkTeam" href="http://www.cnblogs.com/team/database/">数据库团队(0/0)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__2b0c737_TeamList_ctl03_lnkTeam" href="http://www.cnblogs.com/team/elite/">微软社区精英(0/0)</A>
			</LI>
		
			</UL>
		
</DIV>


<H3 class="catListTitle">我的标签</H3>
<DIV id="MyTag">
<UL>
<LI><A href="http://www.cnblogs.com/yukaizhao/tag/sql/">sql</A>(26)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/performance/">performance</A>(10)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/t-sql/">t-sql</A>(10)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/sql+server/">sql server</A>(8)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/sqlite/">sqlite</A>(6)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/linq+to+sql/">linq to sql</A>(6)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96/">性能优化</A>(5)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/c%23/">c#</A>(5)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/asp.net/">asp.net</A>(5)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/css/">css</A>(4)</LI><LI><A href="http://www.cnblogs.com/yukaizhao/tag/">更多</A></LI>
</UL>
</DIV>
<!--done-->

		<H1 class="catListTitle">随笔分类<SPAN style="font-size:11px;font-weight:normal">(372)</SPAN></H1>
		
				<UL class="catList">
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/86889.html">.Net开发经验(105)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/86889.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/134778.html">c#(54)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/134778.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/253396.html">C++(7)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/253396.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/245697.html">linq to sql(6)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/245697.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/133622.html">sql server(26)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/133622.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/88449.html">Xml,XPath,Xsd(1)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/88449.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/87129.html">简单问题(55)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/87129.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/86071.html">客户端(19)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/86071.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/86598.html">软件设计(6)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/86598.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/89973.html">设计模式(2)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/89973.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/90058.html">生活(38)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/90058.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/86382.html">数据库(34)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/86382.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl13_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/86992.html">算法，建模(3)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl13_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/86992.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl14_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/category/89316.html">网站管理(16)</A><A id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl14_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/category/89316.html/rss&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				</UL>
			
	
		<H1 class="catListTitle">随笔档案<SPAN style="font-size:11px;font-weight:normal">(244)</SPAN></H1>
		
				<UL class="catList">
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2010/07.html&#39;);">2010年7月 (12)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl02_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2010/06.html&#39;);">2010年6月 (14)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl03_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2010/05.html&#39;);">2010年5月 (17)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl04_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2010/03.html&#39;);">2010年3月 (2)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl05_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2010/01.html&#39;);">2010年1月 (1)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl06_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/12.html&#39;);">2009年12月 (7)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl07_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/08.html&#39;);">2009年8月 (2)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl08_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/07.html&#39;);">2009年7月 (8)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl09_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/06.html&#39;);">2009年6月 (3)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl10_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/05.html&#39;);">2009年5月 (5)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl11_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/04.html&#39;);">2009年4月 (6)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl12_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/03.html&#39;);">2009年3月 (6)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl13_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/02.html&#39;);">2009年2月 (5)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl14_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2009/01.html&#39;);">2009年1月 (4)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl15_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/12.html&#39;);">2008年12月 (23)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl16_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/11.html&#39;);">2008年11月 (24)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl17_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/10.html&#39;);">2008年10月 (2)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl18_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/09.html&#39;);">2008年9月 (1)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl19_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/08.html&#39;);">2008年8月 (4)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl20_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/07.html&#39;);">2008年7月 (6)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl21_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/06.html&#39;);">2008年6月 (7)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl22_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/05.html&#39;);">2008年5月 (19)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl23_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/04.html&#39;);">2008年4月 (7)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl24_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/03.html&#39;);">2008年3月 (2)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl25_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2008/01.html&#39;);">2008年1月 (1)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl26_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/12.html&#39;);">2007年12月 (3)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl27_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/11.html&#39;);">2007年11月 (2)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl28_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/10.html&#39;);">2007年10月 (1)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl29_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/09.html&#39;);">2007年9月 (3)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl30_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/06.html&#39;);">2007年6月 (3)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl31_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/05.html&#39;);">2007年5月 (6)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl32_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/04.html&#39;);">2007年4月 (22)</A></LI>
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl33_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://www.cnblogs.com/yukaizhao/archive/2007/03.html&#39;);">2007年3月 (16)</A></LI>
			
				</UL>
			
	
		<H1 class="catListTitle">玉开的友链</H1>
		
				<UL class="catList">
			
				<LI class="catListItem"> <A id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_Link" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://blog.sina.com.cn/miaomiao090810&#39;);" target="_blank">小苗子的阳光</A><A id="SingleColumn1_Categories_CatList_ctl02_LinkList_ctl01_RssLink" class="listitem" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="return open_link(&#39;http://blog.sina.com.cn/rss/miaomiao090810.xml&#39;);"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/xml(1).gif" style="border-width:0px;"></A></LI>
			
				</UL>
			
	


<H3 class="catListTitle">最新随笔</H3>
<DIV class="RecentComment" id="RecentPosts">
<UL style="word-break:break-all">
	
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl00_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/28/cpp-vector.html">1.&nbsp;C++基础知识：C++容器类vector实践</A></LI>
		
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl00_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/28/cpp-bitset.html">2.&nbsp;C++基础知识：C++ bitset</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl01_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/20/woman-life.html">3.&nbsp;女人的一生</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl02_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/15/rubish-fight-strategy.html">4.&nbsp;谈谈互动型网站中垃圾贴的应对方案</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl03_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/14/cpp-pointer.html">5.&nbsp;C++基础：指针，函数指针</A></LI>
		
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl03_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/14/cpp-struct.html">6.&nbsp;C++基础：C++的结构struct</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl04_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/13/cpp-control.html">7.&nbsp;C++基础 控制语句</A></LI>
		
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl04_RecentPostsList2_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/13/cpp-var.html">8.&nbsp;c++基础 C++的变量和基础类型</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl05_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/12/cplusplus-hello-word.html">9.&nbsp;C++入门 Hello world</A></LI>
		
		
	
			<LI><A id="SingleColumn1_ctl04_RecentPostsList_ctl06_RecentPostsList2_ctl00_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/05/sql-server-insert-2.html">10.&nbsp;Sql server Insert执行的秘密(下) 带外键的INSERT分析</A></LI>
		
	
</UL>
</DIV>

<H3>积分与排名</H3>
<UL>
	<LI>
		积分 -
		424617
	</LI><LI>
		排名 -
		123
	</LI>
</UL>

<H3 class="catListTitle">最新评论</H3>
<DIV class="RecentComment" id="RecentComments">
	
			<UL>
		
			<LI>
				<A id="SingleColumn1__177ba46_CommentList_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/22/asp-net-new-feature-pure-html.html#1891566">1.&nbsp;Re:Asp.Net 4.0 新特性，输出更纯净的Html代码 ClientIDMode，ViewStateMode等</A>
			</LI>
			<LI>
				htmlhelpe确实很郁闷。
如下问题，谁帮下忙：[url=][/url]
MVC 不是很清楚，不知道能不能不用htmlhelper,用html纯洁控件。
			</LI>
			<LI style="text-align:right;margin-right:4px">
				--★金★</LI>
		
			<LI>
				<A id="SingleColumn1__177ba46_CommentList_ctl02_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/13/linq_to_sql_1.html#1890049">2.&nbsp;Re:LINQ to SQL 系列 如何使用LINQ to SQL插入、修改、删除数据</A>
			</LI>
			<LI>
				此文不错，值得推荐！
			</LI>
			<LI style="text-align:right;margin-right:4px">
				--olymax</LI>
		
			<LI>
				<A id="SingleColumn1__177ba46_CommentList_ctl03_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2009/05/06/barglass_problem.html#1889833">3.&nbsp;Re:使用open flash chart的BarGlass时遇到的问题</A>
			</LI>
			<LI>
				非常支持！！！！
非常支持！！！！
非常支持！！！！
非常支持！！！！
非常支持！！！！
非常支持！！！！
			</LI>
			<LI style="text-align:right;margin-right:4px">
				--emmy</LI>
		
			<LI>
				<A id="SingleColumn1__177ba46_CommentList_ctl04_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/06/12/user-upload-file-structure.html#1889111">4.&nbsp;Re:网站开发中的文件存储 目录结构的探讨</A>
			</LI>
			<LI>
				子目录上万会不会有问题？
			</LI>
			<LI style="text-align:right;margin-right:4px">
				--九百游</LI>
		
			<LI>
				<A id="SingleColumn1__177ba46_CommentList_ctl05_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/21/css3.html#1887679">5.&nbsp;Re:CSS 3太强悍了，有图有真相</A>
			</LI>
			<LI>
				不同意楼主观点，拍砖！
			</LI>
			<LI style="text-align:right;margin-right:4px">
				--john62</LI>
		
			</UL>
		
</DIV>

<H3 class="catListTitle">阅读排行榜</H3>
<DIV class="RecentComment" id="TopViewPosts"> 
	
			<UL style="word-break:break-all">
		
			<LI>
				<A id="SingleColumn1_ctl07_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/04/15/user_role_action_permission.html">1.&nbsp;应用程序权限设计(16324)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl07_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/03/08/layer_develop_errors.html">2.&nbsp;三层开发中容易犯的错误(8102)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl07_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/03/09/pagination_proc_problem.html">3.&nbsp;如此高效通用的分页存储过程是带有sql注入漏洞的(6576)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl07_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/03/25/xsd_tutorial.html">4.&nbsp;如何定义Xsd文件(6253)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl07_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2008/12/15/css_background_image_merge_tool.html">5.&nbsp;Css背景图合并工具功能增强（附V0.11源码和可执行文件）(5245)</A>
			</LI>
		
			</UL>
		
</DIV>

<H3 class="catListTitle">评论排行榜</H3>
<DIV class="RecentComment" id="TopCommentsPosts">
	
			<UL style="word-break:break-all">
		
			<LI>
				<A id="SingleColumn1_ctl08_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2008/12/04/can_we_follow_dot_net_version.html">1.&nbsp;Dot Net版本更新迅速，您跟得上微软的步伐吗，有必要跟吗？(139)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl08_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/03/08/layer_develop_errors.html">2.&nbsp;三层开发中容易犯的错误(134)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl08_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2008/11/13/forum_board_list.html">3.&nbsp;大访问量论坛版面帖子列表页取数据方案探讨(90)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl08_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2007/04/15/user_role_action_permission.html">4.&nbsp;应用程序权限设计(87)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1_ctl08_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2008/12/10/css_bgimage_merge_tool.html">5.&nbsp;高性能网站建设之减少Http连接数(76)</A>
			</LI>
		
			</UL>
		
</DIV>
<H3 class="catListTitle">60天内阅读排行</H3>
<DIV class="RecentComment">
	
			<UL>
		
			<LI>
				<A id="SingleColumn1__c4b360_TopList_ctl01_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/06/22/asp-net-web-archtechture-thinking.html">1.&nbsp;.net程序员应对大规模高性能网站的一点思考(4485)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__c4b360_TopList_ctl02_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/06/30/web20-tag.html">2.&nbsp;你真的理解Web2.0的标签（Tag）吗？能用好它吗？(2321)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__c4b360_TopList_ctl03_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/15/rubish-fight-strategy.html">3.&nbsp;谈谈互动型网站中垃圾贴的应对方案(1988)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__c4b360_TopList_ctl04_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/07/02/sql-server-insert-secret.html">4.&nbsp;Sql server Insert执行的秘密(上)一个最简单的INSERT分析(1923)</A>
			</LI>
		
			<LI>
				<A id="SingleColumn1__c4b360_TopList_ctl05_Hyperlink1" href="http://www.cnblogs.com/yukaizhao/archive/2010/06/29/ood-ocp.html">5.&nbsp;漫谈面向对象基石之开闭原则（OCP）(1780)</A>
			</LI>
		
			</UL>
		
</DIV></DIV>		
	
</DIV>
<DIV id="centercontent">
	
					
<!--done-->
<DIV class="post">
	<DIV class="postTitle">
		<H1><A id="ctl04_TitleUrl" class="postTitle2" href="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园.htm">C#语法糖（Csharp Syntactic sugar）大汇总</A></H1>
	</DIV>
	<P>首先需要声明的是“语法糖”这个词绝非贬义词，它可以给我带来方便，是一种便捷的写法，编译器会帮我们做转换；而且可以提高开发编码的效率，在性能上也不会带来损失。这让java开发人员羡慕不已，呵呵。</P>
<P>&nbsp;</P>
<P><STRONG>1．&nbsp; 经过简化的Property</STRONG> </P>
<P>早些时候我们这样声明Property</P>
<DIV id="highlighter_42111" class="syntaxhighlighter  "><DIV class="bar   "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_42111_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_42111" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>01</CODE></TD><TD class="content"><CODE class="keyword">private</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">_myName;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>02</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>03</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">MyName</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>04</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>05</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>06</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>07</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">get</CODE> <CODE class="plain">{ </CODE><CODE class="keyword">return</CODE> <CODE class="plain">_myName; }</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>08</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>09</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">set</CODE> <CODE class="plain">{ _myName = value; }</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>10</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>11</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>千篇一律的这样声明，没有多大意义，于是C#的设计人员将这个千篇一律的工作交给了编译器帮我们做了，我们现在可以这样声明</P>
<DIV id="highlighter_190619" class="syntaxhighlighter  "><DIV class="bar  "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_190619_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_190619" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">MyName { </CODE><CODE class="keyword">get</CODE><CODE class="plain">; </CODE><CODE class="keyword">set</CODE><CODE class="plain">; }</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>当然他不会牺牲灵活性，我们可以单独给get或者set设定访问限制符，例如</P>
<DIV id="highlighter_352208" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_352208_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_352208" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">MyName { </CODE><CODE class="keyword">get</CODE><CODE class="plain">; </CODE><CODE class="keyword">protected</CODE> <CODE class="keyword">internal</CODE> <CODE class="keyword">set</CODE><CODE class="plain">; }</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P><STRONG>2．&nbsp; 经过两次变异的委托写法</STRONG></P>
<P>在.net 1.1时我们不得不声明方法后才在委托中使用，在.net 2.0之后我们可以使用匿名委托，他不单可以简化写法，还可以在匿名委托中访问范围内的变量；再后来拉姆达表达式来了，写法就更简便了。</P>
<DIV id="highlighter_149816" class="syntaxhighlighter  "><DIV class="bar                                               "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_149816_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_149816" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>01</CODE></TD><TD class="content"><CODE class="keyword">class</CODE> <CODE class="plain">MyClass</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>02</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>03</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">public</CODE> <CODE class="keyword">delegate</CODE> <CODE class="keyword">void</CODE> <CODE class="plain">DoSomething(</CODE><CODE class="keyword">int</CODE> <CODE class="plain">a);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>04</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>05</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="comments">//定义方法委托</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>06</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">private</CODE> <CODE class="keyword">void</CODE> <CODE class="plain">DoIt(</CODE><CODE class="keyword">int</CODE> <CODE class="plain">a) {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>07</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Console.WriteLine(a);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>08</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>09</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>10</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">private</CODE> <CODE class="keyword">void</CODE> <CODE class="plain">HowtoDo(DoSomething doMethod,</CODE><CODE class="keyword">int</CODE> <CODE class="plain">a) {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>11</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">doMethod(a);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>12</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>13</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>14</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">public</CODE> <CODE class="keyword">static</CODE> <CODE class="keyword">void</CODE> <CODE class="plain">Main(</CODE><CODE class="keyword">string</CODE><CODE class="plain">[] args) {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>15</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">MyClass mc = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">MyClass();</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>16</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="comments">//调用定义的方法委托</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>17</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">mc.HowtoDo(</CODE><CODE class="keyword">new</CODE> <CODE class="plain">DoSomething(mc.DoIt), 10);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>18</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">int</CODE> <CODE class="plain">x = 10;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>19</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="comments">//使用匿名委托</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>20</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">mc.HowtoDo(</CODE><CODE class="keyword">delegate</CODE><CODE class="plain">(</CODE><CODE class="keyword">int</CODE> <CODE class="plain">a){</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>21</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Console.WriteLine(a + x);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>22</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">},10);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>23</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>24</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="comments">//使用lamda表达式</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>25</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">mc.HowtoDo(a=&gt;Console.WriteLine(a+x),10);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>26</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>27</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Console.ReadLine();</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>28</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>29</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P><STRONG>3．&nbsp; 集合类的声明</STRONG></P>
<P>之前我们声明一个List并给list赋初始值，必须得这么写：</P>
<DIV id="highlighter_22287" class="syntaxhighlighter  "><DIV class="bar         "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_22287_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_22287" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">List&lt;</CODE><CODE class="keyword">string</CODE><CODE class="plain">&gt; list = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">List&lt;</CODE><CODE class="keyword">string</CODE><CODE class="plain">&gt;();</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">list.Add(</CODE><CODE class="string">"a一"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="plain">list.Add(</CODE><CODE class="string">"b二"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content"><CODE class="plain">list.Add(</CODE><CODE class="string">"c三"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>现在不需要了，直接写就可以了</P>
<DIV id="highlighter_393351" class="syntaxhighlighter  "><DIV class="bar       "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_393351_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_393351" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">List&lt;</CODE><CODE class="keyword">string</CODE><CODE class="plain">&gt; list = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">List&lt;</CODE><CODE class="keyword">string</CODE><CODE class="plain">&gt; {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="string">"def"</CODE><CODE class="plain">,</CODE><CODE class="string">"OK"</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="plain">};</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P><STRONG>4．&nbsp; 集合类各个项的操作</STRONG></P>
<P>我们为了逐个处理集合中的项，需要这么写：</P>
<DIV id="highlighter_2465" class="syntaxhighlighter  "><DIV class="bar    "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_2465_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_2465" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">foreach</CODE> <CODE class="plain">(</CODE><CODE class="keyword">string</CODE> <CODE class="plain">item </CODE><CODE class="keyword">in</CODE> <CODE class="plain">list)</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Console.WriteLine(item);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>现在不需要了，这样就可以了</P>
<DIV id="highlighter_170567" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_170567_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_170567" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">list.ForEach(a =&gt; Console.WriteLine(a));</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>代码是不是清爽了很多。</P>
<P>&nbsp;</P>
<P><STRONG>5．&nbsp; using == try finally</STRONG></P>
<P>为了在使用完毕时释放资源，我们经常要用using，using实质上就是try fiannaly的一个语法糖而已。例如</P>
<DIV id="highlighter_971422" class="syntaxhighlighter  "><DIV class="bar                       "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_971422_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_971422" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">StreamWriter sw = </CODE><CODE class="keyword">null</CODE><CODE class="plain">;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="keyword">try</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">sw = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">StreamWriter(</CODE><CODE class="string">"d:\abc.txt"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>5</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">sw.WriteLine(</CODE><CODE class="string">"test"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>6</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>7</CODE></TD><TD class="content"><CODE class="keyword">finally</CODE> <CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>8</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">if</CODE><CODE class="plain">(sw!= </CODE><CODE class="keyword">null</CODE><CODE class="plain">) sw.Dispose();</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>9</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>上面的代码可以简化为：</P>
<DIV id="highlighter_404644" class="syntaxhighlighter  "><DIV class="bar "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_404644_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_404644" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">using</CODE> <CODE class="plain">(var sw = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">StreamWriter(</CODE><CODE class="string">"d:\abc.txt"</CODE><CODE class="plain">)) {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">sw.WriteLine(</CODE><CODE class="string">"test"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P><STRONG>6．&nbsp; 可爱的var</STRONG></P>
<P>var的意义时不必写声明的类型，编译器会根据后面对var的赋值判断它的类型，var的类型一旦确认就不能再改变，它只能作为局部变量使用，不能用做字段也不能用做参数声明。</P>
<P>例如：</P>
<DIV id="highlighter_845309" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_845309_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_845309" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">var writer = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">StreamWriter(path);</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<DIV id="highlighter_232225" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_232225_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_232225" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">for</CODE><CODE class="plain">(var i=0;i&lt;100;i++){}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P><STRONG>7．&nbsp; 问号的演变</STRONG></P>
<P>老掉牙的一个问号+冒号</P>
<DIV id="highlighter_983663" class="syntaxhighlighter  "><DIV class="bar       "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_983663_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_983663" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">var b = 3;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">var a = b &gt; 9?b.ToString():”0”+b;</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>新宝宝两个问号 ??，它表示左边的变量如果为null则值为右边的变量，否则就是左边的变量值</P>
<DIV id="highlighter_105766" class="syntaxhighlighter  "><DIV class="bar       "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_105766_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_105766" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">string</CODE> <CODE class="plain">a = </CODE><CODE class="keyword">null</CODE><CODE class="plain">;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">var b = a??””;</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P><STRONG>8．&nbsp; 类型实例化的语法糖</STRONG></P>
<DIV id="highlighter_347062" class="syntaxhighlighter  "><DIV class="bar                     "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_347062_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_347062" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">class</CODE> <CODE class="plain">Abc</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">public</CODE> <CODE class="keyword">int</CODE> <CODE class="plain">ID { </CODE><CODE class="keyword">get</CODE><CODE class="plain">; </CODE><CODE class="keyword">set</CODE><CODE class="plain">; }</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>5</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">public</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">Name { </CODE><CODE class="keyword">get</CODE><CODE class="plain">; </CODE><CODE class="keyword">set</CODE><CODE class="plain">; }</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>6</CODE></TD><TD class="content">&nbsp;</TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>7</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">public</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">Url { </CODE><CODE class="keyword">get</CODE><CODE class="plain">; </CODE><CODE class="keyword">set</CODE><CODE class="plain">; }</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>8</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P align="left">我们没有为上面的类声明构造函数，但是我们可以像下面的形式来实例化它</P>
<DIV id="highlighter_563552" class="syntaxhighlighter  "><DIV class="bar                                 "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_563552_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_563552" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">static</CODE> <CODE class="keyword">void</CODE> <CODE class="plain">Main(</CODE><CODE class="keyword">string</CODE><CODE class="plain">[] args) {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">var abc = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">Abc{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">ID=1,</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Name=</CODE><CODE class="string">"yukaizhao"</CODE><CODE class="plain">,</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>5</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">Url=</CODE><CODE class="string">"<A href="http://yukaizhao.cnblogs.com/">http://yukaizhao.cnblogs.com/</A>"</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>6</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">};</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>7</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P><STRONG>9．&nbsp; 传说中的扩展方法</STRONG></P>
<P>在c#3.5时引入了扩展方法，我们可以在不修改类源码的情况下给类增加实例方法，这个很有意义。它的实质也是一种语法糖的实现</P>
<P>例如我们给String类扩展一个IsNumber的方法：</P>
<DIV id="highlighter_309537" class="syntaxhighlighter  "><DIV class="bar                              "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_309537_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_309537" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>01</CODE></TD><TD class="content"><CODE class="keyword">public</CODE> <CODE class="keyword">static</CODE> <CODE class="keyword">class</CODE> <CODE class="plain">StringExt {</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>02</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">static</CODE> <CODE class="keyword">private</CODE> <CODE class="plain">Regex regexNumber = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">Regex(</CODE><CODE class="string">"\\d+"</CODE><CODE class="plain">);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>03</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">static</CODE> <CODE class="keyword">public</CODE> <CODE class="keyword">bool</CODE> <CODE class="plain">IsNumber(</CODE><CODE class="keyword">this</CODE> <CODE class="keyword">string</CODE> <CODE class="plain">input)</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>04</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>05</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">if</CODE> <CODE class="plain">(</CODE><CODE class="keyword">string</CODE><CODE class="plain">.IsNullOrEmpty(input))</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>06</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>07</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">return</CODE> <CODE class="keyword">false</CODE><CODE class="plain">;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>08</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>09</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">return</CODE> <CODE class="plain">regexNumber.IsMatch(input);</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>10</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>11</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>我们可以在String实例上调用这个方法了</P>
<DIV id="highlighter_130539" class="syntaxhighlighter  "><DIV class="bar        "><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_130539_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_130539" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">var abc = “123”;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">var isNumber = abs.IsNumber();</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>&nbsp;</P>
<P>10．使用匿名类</P>
<DIV id="highlighter_376398" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_376398_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_376398" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">var a = </CODE><CODE class="keyword">new</CODE> <CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">ID = 1,Name=”yukaizhao”,BlogUrl=”http:</CODE><CODE class="comments">//www.cnblogs.com/yukaizhao/”</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="plain">};</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV>
<P>匿名类在linq to sql或者entity framework中返回查询数据时很好用。</P>
<P>如果大家还有更多的语法糖，欢迎分享。同时希望大家享受语法糖，因为他可以给我们带来方便，请不要对它嗤之以鼻，也没必要对它嗤之以鼻。</P><DIV id="MySignature"><HR noshade="" size="1" color="#f0f0f0">
<P>请尊重作者的劳动，转载请保留链接&nbsp;<A href="http://www.cnblogs.com/yukaizhao/">玉开的技术博客</A></P>


  <STYLE>
    .divYukaiRecomment{border:1px solid #f0f0f0;}
    .yukaiRecomment{width:700px;margin:5px 0 10px 0px;list-style:none;overflow:auto;zoom:1;padding:5px}
    .yukaiRecomment LI{width:160px;float:left;height:24px;display:block}
    </STYLE>    
    <DIV class="divYukaiRecomment">
    <H5 style="font-family:&quot;微软雅黑&quot;,&quot;黑体&quot;;font-size:18px;text-align:left;border-bottom:1px solid #f0f0f0;padding:5px 0 5px 10px;margin:0">玉开的推荐随笔</H5> 
    <OL class="yukaiRecomment">    
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#aspNetPerformance">Asp.Net 网站优化系列</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#aspNet4NewFeature">Asp.Net 4.0 新特性</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#csharp">c#推荐随笔</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#sqlServer2005">SQL Server 2005</A></LI>
    
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#linq2Sql">LINQ to SQL随笔</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#sqlite">SQLite相关推荐</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#client">客户端Css+js+html</A></LI>
    <LI><A href="http://www.cnblogs.com/yukaizhao/archive/2010/06/25/blog-index.html#other">其他推荐随笔</A></LI>
    </OL>
    </DIV>
<!--ad-->
<TABLE width="712" border="0" cellspacing="1" cellpadding="2" class="fl">
<TBODY><TR><TH align="left" width="40%">Sponsored Links：</TH><TH align="right">&nbsp;
</TH></TR>
<TR><TD colspan="2">
<DIV style="width:710px;overflow:hidden">
<SCRIPT type="text/javascript"><!--
google_ad_client = "pub-2260568282752965";
/* 728x90, 创建于 08-11-10 */
google_ad_slot = "2682509065";
google_ad_width = 728;
google_ad_height = 90;
//-->
</SCRIPT><SCRIPT type="text/javascript" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/show_ads.js">
</SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/expansion_embed.js"></SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/test_domain.js"></SCRIPT><SCRIPT>google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);</SCRIPT><INS style="display:inline-table;border:none;height:90px;margin:0;padding:0;position:relative;visibility:visible;width:728px"><INS id="google_ads_frame1_anchor" style="display:block;border:none;height:90px;margin:0;padding:0;position:relative;visibility:visible;width:728px"><IFRAME allowtransparency="true" frameborder="0" height="90" hspace="0" id="google_ads_frame1" marginheight="0" marginwidth="0" name="google_ads_frame" scrolling="no" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ads.htm" style="left:0;position:absolute;top:0" vspace="0" width="728"></IFRAME></INS></INS>
</DIV>
</TD></TR>
</TBODY></TABLE>
<BR>
<BR>
<DIV class="cuscomment">
反馈文章质量，你可以通过快速通道评论：<BR>
<INPUT type="button" class="fastcomment" name="commentbutton1" style="background: red;" value="很好，推荐">
<INPUT type="button" class="fastcomment" name="commentbutton3" style="background: #c34e4e;" value="一般，加油">&nbsp;
<INPUT type="button" class="fastcomment" name="commentbutton4" style="background: #8d4444;" value="不好，争议">&nbsp;
<INPUT type="button" class="fastcomment" name="commentbutton5" style="background: #9f9f9f;" value="差劲，拍砖">
<INPUT type="button" class="fastcomment" name="commentbutton6" style="background: #c8c8c8;" value="路过，飘过">
</DIV>
</DIV><DIV id="EntryTag">Tag标签: <A href="http://www.cnblogs.com/yukaizhao/tag/csharp/">csharp</A>,<A href="http://www.cnblogs.com/yukaizhao/tag/%e8%af%ad%e6%b3%95%e7%b3%96/">语法糖</A>,<A href="http://www.cnblogs.com/yukaizhao/tag/%e5%8c%bf%e5%90%8d%e5%a7%94%e6%89%98/">匿名委托</A>,<A href="http://www.cnblogs.com/yukaizhao/tag/%e6%89%a9%e5%b1%95%e6%96%b9%e6%b3%95/">扩展方法</A></DIV>
<DIV id="c_jquery_test" style="display:none"></DIV>
<SCRIPT type="text/javascript">
if ($ != jQuery) {
	$ = jQuery.noConflict();
}
</SCRIPT>
<DIV id="digg_block">
<DIV id="author_profile">
<DIV class="author_profile_info">
<A href="http://home.cnblogs.com/yukaizhao/" target="_blank"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/u11387.bmp" class="author_avatar" alt=""></A>
<DIV class="author_profile_info">
<A href="http://home.cnblogs.com/yukaizhao/" target="_blank">玉开</A><BR>
关注 - 38<BR>
粉丝 - 91<BR>
</DIV>
</DIV>
<DIV class="clear"></DIV>
荣誉：<A href="http://www.cnblogs.com/team/elite/" target="_blank">微软社区精英</A>，<A href="http://www.cnblogs.com/expert/" target="_blank">推荐博客</A>
<DIV id="author_profile_follow"> <A href="javascript:void(0);" onclick="login();return false;">关注博主</A></DIV>
</DIV>
<DIV id="div_digg">										
	<DIV class="diggit" onclick="DiggIt(1743293,14943,1)"> 
		<SPAN class="diggnum" id="digg_count_1743293">26</SPAN>
	</DIV>
	<DIV class="buryit" onclick="DiggIt(1743293,14943,2)"> 
		<SPAN class="burynum" id="bury_count_1743293">0</SPAN>
	</DIV>
	<DIV class="clear"></DIV>
	<SPAN style="display:none" id="span_isdigged_1743293">0</SPAN>	
	<DIV class="diggword" id="digg_word_1743293">(请您对文章做出评价)</DIV>	
</DIV>
</DIV>
<DIV class="clear"></DIV>
<DIV id="post_next_prev">
<A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/24/csharp-40-dynamic-optional-argument.html">« </A> 上一篇：<A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/24/csharp-40-dynamic-optional-argument.html" title="发布于2010-05-24 11:24">C# 4.0 新特性dynamic、可选参数、命名参数等</A><BR>
<A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/27/sql-server-index-performance.html">» </A> 下一篇：<A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/27/sql-server-index-performance.html" title="发布于2010-05-27 09:52">Asp.Net网站优化系列 数据库的优化措施 索引优化</A><BR>
</DIV>
<SCRIPT type="text/javascript" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/google_service.js"></SCRIPT>
<SCRIPT type="text/javascript">
    var c_enable_dfp = true;
    if (navigator.userAgent.indexOf("Chrome/6.0.401.1") > 0) {
        c_enable_dfp = false;
    }
    if (c_enable_dfp) {
        try {
            GS_googleAddAdSenseService("ca-pub-4210569241504288");
            GS_googleEnableAllServices();
        }
        catch (e) { }
    }
</SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/google_ads.js"></SCRIPT>
<SCRIPT type="text/javascript">
    if (c_enable_dfp) {
        try {
            GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_body");
            GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_commentbox_up");
            GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_bottom");
            GA_googleAddSlot("ca-pub-4210569241504288", "cnblogs_blogpost_bottom1");
        }
        catch (e) { }
    }
</SCRIPT>
<SCRIPT type="text/javascript">
    if (c_enable_dfp) {
        try {
            GA_googleFetchAds();
        } catch (e) { }
    }
</SCRIPT>
<SCRIPT type="text/javascript">
	var blog_ad_has_shown = false;
	var cb_c_u_id = '';
	var cb_blog_uid = 'd546360b-63cf-dd11-9e4d-001cf0cd104b';
</SCRIPT>




	<DIV class="postDesc">posted on 2010-05-25 09:33 <A href="http://www.cnblogs.com/yukaizhao/">玉开</A> 阅读(5020) <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">评论(46)</A>  <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="open_link(&#39;http://www.cnblogs.com/yukaizhao/admin/EditPosts.aspx?postid=1743293&#39;)">编辑</A> <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#" onclick="AddToWz(1743293);return false;">收藏</A> 所属分类: <A href="http://www.cnblogs.com/yukaizhao/category/86889.html">.Net开发经验</A>, <A href="http://www.cnblogs.com/yukaizhao/category/134778.html">c#</A>, <A href="http://www.cnblogs.com/yukaizhao/category/87129.html">简单问题</A></DIV>
</DIV>
<IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/1743293.html" width="1px" height="1px" alt="">

<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description
rdf:about="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html"
dc:identifier="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html"
dc:title=""
trackback:ping="http://www.cnblogs.com/yukaizhao/services/trackbacks/1743293.aspx" />
</rdf:RDF>
-->

<A name="pagedcomment"></A>
<!--done-->
<BR>
<B>FeedBack:</B>
<DIV class="feedbackNoItems"><SPAN id="span_comment_maxid" style="display:none">1886311</SPAN></DIV>
	

		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832352">#1楼</A><A name="1832352" id="comment_anchor_1832352"></A>&nbsp;2010-05-25 09:52&nbsp;<A id="Comments1_CommentList_ctl00_NameLink" target="_blank">阿桃[未注册用户]</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832352" class="blog_comment_body">第7点说的实在是简单了点</SPAN><BR>　<A onclick="ReplyComment(&quot;阿桃&quot;,1832352,&quot;&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832352,&quot;&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A id="Comments1_CommentList_ctl00_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl00$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl00_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832354">#2楼</A><A name="1832354" id="comment_anchor_1832354"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 09:53&nbsp;<A id="Comments1_CommentList_ctl01_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832354" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832352" title="查看所回复的评论">@</A>阿桃<BR>这个东东本身就很简单呀，有没明白的地方吗？<BR></SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832354,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832354,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl01_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl01$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl01_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832359">#3楼</A><A name="1832359" id="comment_anchor_1832359"></A>&nbsp;2010-05-25 09:58&nbsp;<A id="Comments1_CommentList_ctl02_NameLink" href="http://www.cnblogs.com/oceanchow/" target="_blank">OC Life</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/OC+Life" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832359" class="blog_comment_body">糖都比较甜，但也不能老吃</SPAN><BR>　<A onclick="ReplyComment(&quot;OC Life&quot;,1832359,&quot;d6I7EfuLAT67SyoGGTqe3cnJQjqSLVXYpK/3Y+x7bLsmqfWCj3UwUw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832359,&quot;d6I7EfuLAT67SyoGGTqe3cnJQjqSLVXYpK/3Y+x7bLsmqfWCj3UwUw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=OC+Life" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl02_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl02$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl02_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832365">#4楼</A><A name="1832365" id="comment_anchor_1832365"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 10:00&nbsp;<A id="Comments1_CommentList_ctl03_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832365" class="blog_comment_body"><FIELDSET class="comment_quote"><LEGEND><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832359" title="查看引用原文">引用</A></LEGEND>OC Life：糖都比较甜，但也不能老吃</FIELDSET><BR>没关系吧，这个糖也不会坏牙。哈哈</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832365,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832365,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl03_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl03$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl03_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832398">#5楼</A><A name="1832398" id="comment_anchor_1832398"></A>&nbsp;2010-05-25 10:27&nbsp;<A id="Comments1_CommentList_ctl04_NameLink" href="http://www.cnblogs.com/jimnox/" target="_blank">JimLiu</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/JimLiu" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832398" class="blog_comment_body"><FIELDSET class="comment_quote"><LEGEND><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832359" title="查看引用原文">引用</A></LEGEND>OC Life：糖都比较甜，但也不能老吃</FIELDSET><BR>这糖随便吃……有什么不能老吃的</SPAN><BR>　<A onclick="ReplyComment(&quot;JimLiu&quot;,1832398,&quot;Q0Ua011E++6cQ858O4DqBvVaMVd9Dk4VSvIdYM62lZdKDZ44tGngDA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832398,&quot;Q0Ua011E++6cQ858O4DqBvVaMVd9Dk4VSvIdYM62lZdKDZ44tGngDA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=JimLiu" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl04_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl04$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl04_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832443">#6楼</A><A name="1832443" id="comment_anchor_1832443"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 10:59&nbsp;<A id="Comments1_CommentList_ctl05_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832443" class="blog_comment_body">如果是团队开发，使用这些语法糖时需要考虑是否影响相互之间的沟通。这算一点副作用吧。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832443,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832443,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl05_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl05$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl05_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832465">#7楼</A><A name="1832465" id="comment_anchor_1832465"></A>&nbsp;2010-05-25 11:17&nbsp;<A id="Comments1_CommentList_ctl06_NameLink" href="http://www.cnblogs.com/k-sharp/" target="_blank">K#</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/K%23" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832465" class="blog_comment_body">我想添一块糖：<BR><BR><B>private void HowtoDo(DoSomething doMethod,int a)<BR><BR>==》<BR><BR>private void HowtoDo(Action&lt;int&gt; doMethod,int a)</B></SPAN><BR>　<A onclick="ReplyComment(&quot;K#&quot;,1832465,&quot;7qTUB1GXK9tMhwKBEMifLn803lkAOKkyWTjRLsXNtBCxFykf43I9yw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832465,&quot;7qTUB1GXK9tMhwKBEMifLn803lkAOKkyWTjRLsXNtBCxFykf43I9yw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=K%23" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl06_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl06$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl06_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832470">#8楼</A><A name="1832470" id="comment_anchor_1832470"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 11:21&nbsp;<A id="Comments1_CommentList_ctl07_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832470" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832465" title="查看所回复的评论">@</A>K#<BR>3Q, 确实是一块糖呀。<BR><BR></SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832470,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832470,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl07_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl07$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl07_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832540">#9楼</A><A name="1832540" id="comment_anchor_1832540"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 12:14&nbsp;<A id="Comments1_CommentList_ctl08_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832540" class="blog_comment_body">增加了第十个语法糖，匿名类。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832540,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832540,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl08_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl08$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl08_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832574">#10楼</A><A name="1832574" id="comment_anchor_1832574"></A>&nbsp;2010-05-25 13:05&nbsp;<A id="Comments1_CommentList_ctl09_NameLink" href="http://www.cnblogs.com/GameCode/" target="_blank">向恺然</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e5%90%91%e6%81%ba%e7%84%b6" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832574" class="blog_comment_body">语法糖的第一条写错了吧，同一个变量的时候可以简写。但对一个private变量进行set/get 的时候是不能简写的。</SPAN><BR>　<A onclick="ReplyComment(&quot;向恺然&quot;,1832574,&quot;kR3Y3TLWP5HfD9EZIdc4kETBdCTtLvS7yqTGjpGpf1s7q/PEc6y5Ow==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832574,&quot;kR3Y3TLWP5HfD9EZIdc4kETBdCTtLvS7yqTGjpGpf1s7q/PEc6y5Ow==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e5%90%91%e6%81%ba%e7%84%b6" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl09_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl09$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl09_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832579">#11楼</A><A name="1832579" id="comment_anchor_1832579"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 13:15&nbsp;<A id="Comments1_CommentList_ctl10_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832579" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832574" title="查看所回复的评论">@</A>向恺然<BR>没明白你的意思啊，请详细说下</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832579,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832579,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl10_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl10$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl10_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832585">#12楼</A><A name="1832585" id="comment_anchor_1832585"></A>&nbsp;2010-05-25 13:24&nbsp;<A id="Comments1_CommentList_ctl11_NameLink" href="http://home.cnblogs.com/135233/" target="_blank">c#学员</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/c%23%e5%ad%a6%e5%91%98" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832585" class="blog_comment_body">学习啦</SPAN><BR>　<A onclick="ReplyComment(&quot;c#学员&quot;,1832585,&quot;aa57jAb67sz73M737pMpa5KvYWnR4Z5T6em3C7ju5axJRSQXVgECGg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832585,&quot;aa57jAb67sz73M737pMpa5KvYWnR4Z5T6em3C7ju5axJRSQXVgECGg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=c%23%e5%ad%a6%e5%91%98" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl11_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl11$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl11_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832588">#13楼</A><A name="1832588" id="comment_anchor_1832588"></A>&nbsp;2010-05-25 13:29&nbsp;<A id="Comments1_CommentList_ctl12_NameLink" href="http://home.cnblogs.com/97656/" target="_blank">东华一只球</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e4%b8%9c%e5%8d%8e%e4%b8%80%e5%8f%aa%e7%90%83" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832588" class="blog_comment_body">不错不错，挺甜的~~~</SPAN><BR>　<A onclick="ReplyComment(&quot;东华一只球&quot;,1832588,&quot;jJJamd/FKMOnwiqMegljl7yq66WIWUcCjx36wZeE3NJqTsxLVFyaNw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832588,&quot;jJJamd/FKMOnwiqMegljl7yq66WIWUcCjx36wZeE3NJqTsxLVFyaNw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e4%b8%9c%e5%8d%8e%e4%b8%80%e5%8f%aa%e7%90%83" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl12_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl12$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl12_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832596">#14楼</A><A name="1832596" id="comment_anchor_1832596"></A>&nbsp;2010-05-25 13:35&nbsp;<A id="Comments1_CommentList_ctl13_NameLink" href="http://www.cnblogs.com/dixin/" target="_blank">Dixin</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Dixin" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832596" class="blog_comment_body">list.ForEach(a =&gt; Console.WriteLine(a));<BR>可以写成<BR>list.ForEach(Console.WriteLine);<BR><BR>楼主别忘了foreach关键字本身就是一个语法糖:)<BR><BR>还有史上最甜的语法糖：lambda表达式-&gt;表达式目录树(expression tree)：<BR><A href="http://weblogs.asp.net/dixin/archive/2009/11/29/understanding-csharp-3-0-features-6-lambda-expression.aspx" target="_blank">http://weblogs.asp.net/dixin/archive/2009/11/29/understanding-csharp-3-0-features-6-lambda-expression.aspx</A></SPAN><BR>　<A onclick="ReplyComment(&quot;Dixin&quot;,1832596,&quot;hkGOmFyHSRFJ77LXoGIQk7E6oURnn8dNOdrkBw1NGThdr0FKqX4h8Q==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832596,&quot;hkGOmFyHSRFJ77LXoGIQk7E6oURnn8dNOdrkBw1NGThdr0FKqX4h8Q==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Dixin" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl13_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl13$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl13_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832612">#15楼</A><A name="1832612" id="comment_anchor_1832612"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 13:54&nbsp;<A id="Comments1_CommentList_ctl14_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832612" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832596" title="查看所回复的评论">@</A>Dixin<BR>3Q,我把lambda表达式归到委托一类里面了。 文中第二个语法糖。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832612,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832612,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl14_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl14$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl14_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832643">#16楼</A><A name="1832643" id="comment_anchor_1832643"></A>&nbsp;2010-05-25 14:23&nbsp;<A id="Comments1_CommentList_ctl15_NameLink" href="http://www.cnblogs.com/tltgg/" target="_blank">我想我是风</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832643" class="blog_comment_body">list.ForEach(a =&gt; Console.WriteLine(a));<BR><BR>这个确定是这样的么？我怎么看到的都是ForEach是静态方法，不是扩展方法呢</SPAN><BR>　<A onclick="ReplyComment(&quot;我想我是风&quot;,1832643,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832643,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl15_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl15$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl15_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832649">#17楼</A><A name="1832649" id="comment_anchor_1832649"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 14:26&nbsp;<A id="Comments1_CommentList_ctl16_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832649" class="blog_comment_body"><FIELDSET class="comment_quote"><LEGEND><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832643" title="查看引用原文">引用</A></LEGEND>我想我是风：<BR>list.ForEach(a =&gt; Console.WriteLine(a));<BR><BR>这个确定是这样的么？我怎么看到的都是ForEach是静态方法，不是扩展方法呢</FIELDSET><BR><BR>这个绝对是扩展方法。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832649,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832649,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl16_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl16$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl16_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832650">#18楼</A><A name="1832650" id="comment_anchor_1832650"></A>&nbsp;2010-05-25 14:28&nbsp;<A id="Comments1_CommentList_ctl17_NameLink" href="http://www.cnblogs.com/tltgg/" target="_blank">我想我是风</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832650" class="blog_comment_body">我也记得之前是可以的，但现在都不行呀<BR>string[] list  = { "11", "22" };<BR>list.ForEach(a =&gt; Console.WriteLine(a));<BR><BR>Error	1<BR>	No overload for method 'ForEach' takes 1 arguments</SPAN><BR>　<A onclick="ReplyComment(&quot;我想我是风&quot;,1832650,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832650,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl17_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl17$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl17_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832651">#19楼</A><A name="1832651" id="comment_anchor_1832651"></A>&nbsp;2010-05-25 14:30&nbsp;<A id="Comments1_CommentList_ctl18_NameLink" href="http://www.cnblogs.com/tltgg/" target="_blank">我想我是风</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832651" class="blog_comment_body">Array.ForEach(list，a =&gt; Console.WriteLine(a));这样是可以</SPAN><BR>　<A onclick="ReplyComment(&quot;我想我是风&quot;,1832651,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832651,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl18_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl18$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl18_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832652">#20楼</A><A name="1832652" id="comment_anchor_1832652"></A>&nbsp;2010-05-25 14:31&nbsp;<A id="Comments1_CommentList_ctl19_NameLink" href="http://www.cnblogs.com/jy00361722/" target="_blank">Coppola</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Coppola" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832652" class="blog_comment_body">真甜～</SPAN><BR>　<A onclick="ReplyComment(&quot;Coppola&quot;,1832652,&quot;f9dFCxEQOGJ0BHvhJmhSQLFupwurVzWoQbR5QUJlbdlZxMxq/1Hhcg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832652,&quot;f9dFCxEQOGJ0BHvhJmhSQLFupwurVzWoQbR5QUJlbdlZxMxq/1Hhcg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Coppola" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl19_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl19$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl19_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832661">#21楼</A><A name="1832661" id="comment_anchor_1832661"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 14:44&nbsp;<A id="Comments1_CommentList_ctl20_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832661" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832650" title="查看所回复的评论">@</A>我想我是风<BR>是这样的，我说的那个list的类型是一个泛型的string list<BR>List&lt;string&gt;。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832661,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832661,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl20_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl20$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl20_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832670">#22楼</A><A name="1832670" id="comment_anchor_1832670"></A>&nbsp;2010-05-25 14:55&nbsp;<A id="Comments1_CommentList_ctl21_NameLink" href="http://www.cnblogs.com/tltgg/" target="_blank">我想我是风</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832670" class="blog_comment_body">原来如此，我是说怎么回事，以前还用的好好的，怎么突然没有了。<BR>不过好奇怪，怎么只针对System.Collections.Generic.List(Of T)扩展呢，不针对IEnumerable&lt;T&gt;扩展，那用foreach关键字的地方还是不能都替换成foreach扩展方法</SPAN><BR>　<A onclick="ReplyComment(&quot;我想我是风&quot;,1832670,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832670,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl21_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl21$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl21_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832672">#23楼</A><A name="1832672" id="comment_anchor_1832672"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 15:06&nbsp;<A id="Comments1_CommentList_ctl22_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832672" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832670" title="查看所回复的评论">@</A>我想我是风<BR>你说的很对。确实不是所有地方都可以这么用。<BR><BR>不知道为什么没有去扩展接口，可能是扩展接口会带来什么问题吧。<BR><BR>虽然在c#的语法中可以对接口进行扩展，但是感觉扩展接口是一种不大好的设计。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832672,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832672,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl22_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl22$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl22_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832685">#24楼</A><A name="1832685" id="comment_anchor_1832685"></A>&nbsp;2010-05-25 15:21&nbsp;<A id="Comments1_CommentList_ctl23_NameLink" href="http://www.cnblogs.com/tltgg/" target="_blank">我想我是风</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832685" class="blog_comment_body">但LINQ的扩展都是针对IEnumerable&lt;T&gt;的，要说不好的设计应该也不太说的过去，foreach关键字和foreach方法的目标应该是一样的，不应该出现歧义吧</SPAN><BR>　<A onclick="ReplyComment(&quot;我想我是风&quot;,1832685,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832685,&quot;lgOkhi0aWBNZKRsWyRjV8K8sLo4ekHHpnHU6CJ00s4H7bR5X9IZaCg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%88%91%e6%83%b3%e6%88%91%e6%98%af%e9%a3%8e" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl23_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl23$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl23_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832689">#25楼</A><A name="1832689" id="comment_anchor_1832689"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 15:26&nbsp;<A id="Comments1_CommentList_ctl24_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832689" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832685" title="查看所回复的评论">@</A>我想我是风<BR>应该没有歧义，不过还是有区别的，例如<BR>int times = 0;<BR>foreach(int i in intList){<BR>  if(times % 2 == 0)continue;<BR>  Console.WriteLine(i);<BR>  times ++;<BR>  if(times &gt; 3)break;<BR>}<BR><BR>如果用方法写的话就会有问题，可以支持continue，但是却不能执行break</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832689,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832689,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl24_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl24$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl24_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832708">#26楼</A><A name="1832708" id="comment_anchor_1832708"></A>&nbsp;2010-05-25 15:47&nbsp;<A id="Comments1_CommentList_ctl25_NameLink" href="http://www.cnblogs.com/Freewind22/" target="_blank">Freewind</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Freewind" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832708" class="blog_comment_body">看着有点像JavaScript了.</SPAN><BR>　<A onclick="ReplyComment(&quot;Freewind&quot;,1832708,&quot;YOqgq1s1BKY5kMC1FUAstwY++NIzhBx5uPSUYsjsVyiFNQn3UbLTwQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832708,&quot;YOqgq1s1BKY5kMC1FUAstwY++NIzhBx5uPSUYsjsVyiFNQn3UbLTwQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Freewind" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl25_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl25$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl25_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832719">#27楼</A><A name="1832719" id="comment_anchor_1832719"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 15:56&nbsp;<A id="Comments1_CommentList_ctl26_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832719" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832708" title="查看所回复的评论">@</A>Freewind<BR>c#正在吸取各种语言的先进理念为我所用。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832719,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832719,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl26_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl26$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl26_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832796">#28楼</A><A name="1832796" id="comment_anchor_1832796"></A>&nbsp;2010-05-25 17:13&nbsp;<A id="Comments1_CommentList_ctl27_NameLink" href="http://www.cnblogs.com/ly4cn/" target="_blank">沐枫</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%b2%90%e6%9e%ab" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832796" class="blog_comment_body">难首try finally不是语法糖？ <BR>get set不是？<BR>class不是？<BR>以致于operator + - * / % 等不是吗？<BR>override/overload不是？float/int/string不是？<BR><BR>糖有点甜，不能常吃？可是生活中，哪样东西少了糖？<BR><BR></SPAN><BR>　<A onclick="ReplyComment(&quot;沐枫&quot;,1832796,&quot;yxxwQ6dn3WBizMShfNBeZ/D/7KB+fiG+AIZMuLdAefaS9QmTg93BIA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832796,&quot;yxxwQ6dn3WBizMShfNBeZ/D/7KB+fiG+AIZMuLdAefaS9QmTg93BIA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%b2%90%e6%9e%ab" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl27_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl27$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl27_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832839">#29楼</A><A name="1832839" id="comment_anchor_1832839"></A>&nbsp;2010-05-25 18:12&nbsp;<A id="Comments1_CommentList_ctl28_NameLink" href="http://www.cnblogs.com/heaiping/" target="_blank">Alex He</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Alex+He" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832839" class="blog_comment_body"><FIELDSET class="comment_quote"><LEGEND><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832796" title="查看引用原文">引用</A></LEGEND>沐枫：<BR>难首try finally不是语法糖？ <BR>get set不是？<BR>class不是？<BR>以致于operator + - * / % 等不是吗？<BR>override/overload不是？float/int/string不是？<BR><BR>糖有点甜，不能常吃？可是生活中，哪样东西少了糖？<BR><BR></FIELDSET><BR>盐里面可以没有糖</SPAN><BR>　<A onclick="ReplyComment(&quot;Alex He&quot;,1832839,&quot;FeIrShvHearjQc/y/1TlSjkVnhi8VY0WLaWNoscZsOMC8gJlmZkyvQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832839,&quot;FeIrShvHearjQc/y/1TlSjkVnhi8VY0WLaWNoscZsOMC8gJlmZkyvQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Alex+He" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl28_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl28$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl28_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832846">#30楼</A><A name="1832846" id="comment_anchor_1832846"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 18:25&nbsp;<A id="Comments1_CommentList_ctl29_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832846" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832796" title="查看所回复的评论">@</A>沐枫<BR>照这么说除了机器码，没有不是糖的了。相对而言，事物有相对性。<BR><BR>没必要死揪着这点概念。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832846,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832846,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl29_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl29$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl29_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832854">#31楼</A><A name="1832854" id="comment_anchor_1832854"></A>&nbsp;2010-05-25 19:01&nbsp;<A id="Comments1_CommentList_ctl30_NameLink" href="http://www.cnblogs.com/vwxyzh/" target="_blank">Zhenway</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Zhenway" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832854" class="blog_comment_body">list.ForEach(a =&gt; Console.WriteLine(a));<BR>这个还简单？<BR>看看这个：<BR>list.ForEach(Console.WriteLine);<BR>少了多少符号</SPAN><BR>　<A onclick="ReplyComment(&quot;Zhenway&quot;,1832854,&quot;ckoNgh87V16c9AST8pRtLqhNwFtVC5n2frPqmXSUKBXBs4GEUUknwA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832854,&quot;ckoNgh87V16c9AST8pRtLqhNwFtVC5n2frPqmXSUKBXBs4GEUUknwA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Zhenway" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl30_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl30$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl30_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832869">#32楼</A><A name="1832869" id="comment_anchor_1832869"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 19:47&nbsp;<A id="Comments1_CommentList_ctl31_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832869" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832854" title="查看所回复的评论">@</A>Zhenway<BR>不错。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832869,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832869,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl31_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl31$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl31_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832873">#33楼</A><A name="1832873" id="comment_anchor_1832873"></A>&nbsp;2010-05-25 19:59&nbsp;<A id="Comments1_CommentList_ctl32_NameLink" target="_blank">wocao[未注册用户]</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832873" class="blog_comment_body">在js面前，羞煞人也</SPAN><BR>　<A onclick="ReplyComment(&quot;wocao&quot;,1832873,&quot;&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832873,&quot;&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A id="Comments1_CommentList_ctl32_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl32$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl32_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832933">#34楼</A><A name="1832933" id="comment_anchor_1832933"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-25 22:26&nbsp;<A id="Comments1_CommentList_ctl33_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832933" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832873" title="查看所回复的评论">@</A>wocao<BR>两种语言的适用范围也很不相同呀。c#毕竟是静态语言。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1832933,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832933,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl33_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl33$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl33_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832956">#35楼</A><A name="1832956" id="comment_anchor_1832956"></A>&nbsp;2010-05-25 23:29&nbsp;<A id="Comments1_CommentList_ctl34_NameLink" href="http://www.cnblogs.com/Alexander-Lee/" target="_blank">亚历山大同志</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e4%ba%9a%e5%8e%86%e5%b1%b1%e5%a4%a7%e5%90%8c%e5%bf%97" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832956" class="blog_comment_body">说糖不能多吃那个纯属放屁，估计看了个标题就来回复了，严重鄙视这种胡乱拍砖党</SPAN><BR>　<A onclick="ReplyComment(&quot;亚历山大同志&quot;,1832956,&quot;A0HWFeL2VzPLtePG9xKLxYe123aPyflYe0acI+TfojLceT0pSrwf3g==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832956,&quot;A0HWFeL2VzPLtePG9xKLxYe123aPyflYe0acI+TfojLceT0pSrwf3g==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e4%ba%9a%e5%8e%86%e5%b1%b1%e5%a4%a7%e5%90%8c%e5%bf%97" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl34_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl34$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl34_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832984">#36楼</A><A name="1832984" id="comment_anchor_1832984"></A>&nbsp;2010-05-26 00:32&nbsp;<A id="Comments1_CommentList_ctl35_NameLink" href="http://www.cnblogs.com/skyaspnet/" target="_blank">skyaspnet</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/skyaspnet" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1832984" class="blog_comment_body"> using == try finally<BR>这个没有Catch啊，是不是不太好？如果发生异常的话，没有专门进行捕获异常</SPAN><BR>　<A onclick="ReplyComment(&quot;skyaspnet&quot;,1832984,&quot;+UBC7X6h+3ghAfiO0htzYz1An3cQgcVBTfFyzSxnpucUxLKE1I/Emg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1832984,&quot;+UBC7X6h+3ghAfiO0htzYz1An3cQgcVBTfFyzSxnpucUxLKE1I/Emg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=skyaspnet" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl35_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl35$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl35_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833016">#37楼</A><A name="1833016" id="comment_anchor_1833016"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-26 07:43&nbsp;<A id="Comments1_CommentList_ctl36_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1833016" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1832984" title="查看所回复的评论">@</A>skyaspnet<BR>异常处理可以统一进行处理，有的地方出了异常最好的办法就是把异常抛出去，让上一层去处理。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1833016,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1833016,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl36_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl36$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl36_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833061">#38楼</A><A name="1833061" id="comment_anchor_1833061"></A>&nbsp;2010-05-26 09:08&nbsp;<A id="Comments1_CommentList_ctl37_NameLink" href="http://www.cnblogs.com/youzelin/" target="_blank">Jeffery You</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Jeffery+You" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1833061" class="blog_comment_body">还有 yield return:<BR><BR><DIV id="highlighter_781914" class="syntaxhighlighter  "><DIV class="bar"><DIV class="toolbar"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#viewSource" title="view source" style="width: 16px; height: 16px; " class="item viewSource">view source</A><DIV class="item copyToClipboard"><EMBED width="16" height="16" id="highlighter_781914_clipboard" type="application/x-shockwave-flash" title="copy to clipboard" allowscriptaccess="always" wmode="transparent" flashvars="highlighterId=highlighter_781914" menu="false" src="http://common.cnblogs.com/flash/clipboard.swf"></DIV><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#printSource" title="print" style="width: 16px; height: 16px; " class="item printSource">print</A><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#about" title="?" style="width: 16px; height: 16px; " class="item about">?</A></DIV></DIV><DIV class="lines"><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>1</CODE></TD><TD class="content"><CODE class="plain">IEumerable&lt;</CODE><CODE class="keyword">int</CODE><CODE class="plain">&gt; GetItems(List&lt;</CODE><CODE class="keyword">int</CODE><CODE class="plain">&gt; list)</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>2</CODE></TD><TD class="content"><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>3</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">foreach</CODE> <CODE class="plain">(</CODE><CODE class="keyword">int</CODE> <CODE class="plain">i </CODE><CODE class="keyword">in</CODE> <CODE class="plain">list)</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>4</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">{</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>5</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="keyword">if</CODE> <CODE class="plain">(i &gt; 0) </CODE><CODE class="keyword">yield</CODE> <CODE class="keyword">return</CODE> <CODE class="plain">i;</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt2"><TABLE><TBODY><TR><TD class="number"><CODE>6</CODE></TD><TD class="content"><CODE class="spaces">&nbsp;&nbsp;&nbsp;&nbsp;</CODE><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV><DIV class="line alt1"><TABLE><TBODY><TR><TD class="number"><CODE>7</CODE></TD><TD class="content"><CODE class="plain">}</CODE></TD></TR></TBODY></TABLE></DIV></DIV></DIV><BR><BR>:)</SPAN><BR>　<A onclick="ReplyComment(&quot;Jeffery You&quot;,1833061,&quot;91EzqXrf0nM8FeEKVmh+JiITWo9LGsVTwzTdqIUR5T+KeFRifQIvpA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1833061,&quot;91EzqXrf0nM8FeEKVmh+JiITWo9LGsVTwzTdqIUR5T+KeFRifQIvpA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Jeffery+You" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl37_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl37$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl37_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833295">#39楼</A><A name="1833295" id="comment_anchor_1833295"></A>&nbsp;2010-05-26 12:38&nbsp;<A id="Comments1_CommentList_ctl38_NameLink" href="http://home.cnblogs.com/61724/" target="_blank">Linq.C# .</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Linq.C%23+." title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1833295" class="blog_comment_body">@玉开<BR>ForEach（） 在.net 2.0时代就有了。。<BR>不是扩展方法<BR>只有现在有了 lambda 才可以 ForEach(p=&gt;p...);这样得调用。</SPAN><BR>　<A onclick="ReplyComment(&quot;Linq.C# .&quot;,1833295,&quot;yizmfHZJQdu8zwNGdq4gN/CBpfd0MBtf7gpnP/hWEFWsNjzgEIRDnw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1833295,&quot;yizmfHZJQdu8zwNGdq4gN/CBpfd0MBtf7gpnP/hWEFWsNjzgEIRDnw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Linq.C%23+." target="_blank">查看</A>　<A id="Comments1_CommentList_ctl38_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl38$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl38_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833310">#40楼</A><A name="1833310" id="comment_anchor_1833310"></A>&nbsp;2010-05-26 13:03&nbsp;<A id="Comments1_CommentList_ctl39_NameLink" href="http://www.cnblogs.com/skyaspnet/" target="_blank">skyaspnet</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/skyaspnet" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1833310" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833295" title="查看所回复的评论">@</A>Linq.C# .<BR>但是这样有个问题，使用了using并且如果不在using{....}里加异常处理的话，这个异常就会被吃掉，如果在里面加了异常处理，感觉又有点冗余，不知道是不是有更好的处理方法？谢谢！</SPAN><BR>　<A onclick="ReplyComment(&quot;skyaspnet&quot;,1833310,&quot;+UBC7X6h+3ghAfiO0htzYz1An3cQgcVBTfFyzSxnpucUxLKE1I/Emg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1833310,&quot;+UBC7X6h+3ghAfiO0htzYz1An3cQgcVBTfFyzSxnpucUxLKE1I/Emg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=skyaspnet" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl39_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl39$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl39_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833366">#41楼</A><A name="1833366" id="comment_anchor_1833366"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-05-26 14:06&nbsp;<A id="Comments1_CommentList_ctl40_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1833366" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1833310" title="查看所回复的评论">@</A>skyaspnet<BR>这里的异常不会被“吃掉”，而是会被抛出去。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1833366,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1833366,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl40_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl40$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl40_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1843041">#42楼</A><A name="1843041" id="comment_anchor_1843041"></A>&nbsp;2010-06-08 14:55&nbsp;<A id="Comments1_CommentList_ctl41_NameLink" href="http://home.cnblogs.com/112591/" target="_blank">Dennis.Yang</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/Dennis.Yang" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1843041" class="blog_comment_body">恩，不错的东西，当年从2005转到2008的主要原因</SPAN><BR>　<A onclick="ReplyComment(&quot;Dennis.Yang&quot;,1843041,&quot;G6epWzdM+waUBNiatb+gX2YXTSVlYxC6RIIt2oP44c0my5kvYeK7Rw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1843041,&quot;G6epWzdM+waUBNiatb+gX2YXTSVlYxC6RIIt2oP44c0my5kvYeK7Rw==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=Dennis.Yang" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl41_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl41$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl41_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1861354">#43楼</A><A name="1861354" id="comment_anchor_1861354"></A>&nbsp;2010-07-01 12:00&nbsp;<A id="Comments1_CommentList_ctl42_NameLink" href="http://www.cnblogs.com/hengy/" target="_blank">恒源</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e6%81%92%e6%ba%90" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1861354" class="blog_comment_body">语法糖不错，但我要忍住不用，因为不利用团队开发。<BR>以前代码怎么简洁怎么写，现在是怎么易懂优先。<BR>特别拉姆表达式等匿名的写法，一定要写好注释。</SPAN><BR>　<A onclick="ReplyComment(&quot;恒源&quot;,1861354,&quot;SRP3sYYWZHJFgq1jlO4N3dRgBOa0E75G5defivKsz4sL+9KbgGrhXg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1861354,&quot;SRP3sYYWZHJFgq1jlO4N3dRgBOa0E75G5defivKsz4sL+9KbgGrhXg==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e6%81%92%e6%ba%90" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl42_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl42$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl42_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1861434">#44楼</A><A name="1861434" id="comment_anchor_1861434"></A>[<SPAN class="louzhu">楼主</SPAN>]&nbsp;2010-07-01 13:52&nbsp;<A id="Comments1_CommentList_ctl43_NameLink" href="http://www.cnblogs.com/yukaizhao/" target="_blank">玉开</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e7%8e%89%e5%bc%80" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1861434" class="blog_comment_body"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1861354" title="查看所回复的评论">@</A>恒源<BR>注释是必要的，这与语法糖没关系。<BR><BR>不要看低你的队友呀。<BR><BR>说不定他们在使用语法糖上比你还纠结。</SPAN><BR>　<A onclick="ReplyComment(&quot;玉开&quot;,1861434,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1861434,&quot;OtU5KxlYv4z5OZGGpojSxy6cko9zOKHdMM4bZR6QsHir3A40TXKoAA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e7%8e%89%e5%bc%80" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl43_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl43$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl43_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1865482">#45楼</A><A name="1865482" id="comment_anchor_1865482"></A>&nbsp;2010-07-06 23:36&nbsp;<A id="Comments1_CommentList_ctl44_NameLink" href="http://home.cnblogs.com/75177/" target="_blank">lpyedge</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/lpyedge" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1865482" class="blog_comment_body">此文不错，值得推荐！</SPAN><BR>　<A onclick="ReplyComment(&quot;lpyedge&quot;,1865482,&quot;L/rjto6emtC1A2cP02MfQsQpr5idwvK938mXFwQnAFmOz3b+OCX3QA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1865482,&quot;L/rjto6emtC1A2cP02MfQsQpr5idwvK938mXFwQnAFmOz3b+OCX3QA==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=lpyedge" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl44_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl44$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl44_EditLink"></A>
			</DIV>
		</DIV>
	
		<DIV class="feedbackItem">
			<DIV class="feedbackListSubtitle">
			<DIV class="feedbacktitle"><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#1886311">#46楼</A><A name="1886311" id="comment_anchor_1886311"></A><A name="Post"></A>&nbsp;2010-08-03 18:19&nbsp;<A id="Comments1_CommentList_ctl45_NameLink" href="http://www.cnblogs.com/ldp615/" target="_blank">鹤冲天</A>&nbsp;<A href="http://space.cnblogs.com/msg/send/%e9%b9%a4%e5%86%b2%e5%a4%a9" title="给此人发送站内短消息" class="sendMsg2This">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</A></DIV>
				<DIV align="left"><SPAN id="comment_body_1886311" class="blog_comment_body">没有这些语法糖，简直活不下去。</SPAN><BR>　<A onclick="ReplyComment(&quot;鹤冲天&quot;,1886311,&quot;M6id96rJPqTYUDlY5MX5B3YviJB/4u7etDHNwrqpCYcAvgecLUKCQQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">回复</A>　<A onclick="QuoteComment(1886311,&quot;M6id96rJPqTYUDlY5MX5B3YviJB/4u7etDHNwrqpCYcAvgecLUKCQQ==&quot;)" href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#commentform">引用</A>　<A title="查看该作者发表过的评论" href="http://www.cnblogs.com/CommentsByAuthor.aspx?author=%e9%b9%a4%e5%86%b2%e5%a4%a9" target="_blank">查看</A>　<A id="Comments1_CommentList_ctl45_DeleteLink" href="javascript:__doPostBack('Comments1$CommentList$ctl45$DeleteLink','')"></A>&nbsp;&nbsp;<A id="Comments1_CommentList_ctl45_EditLink"></A>
			</DIV>
		</DIV>
	
<SCRIPT type="text/javascript">
    var commentAuthorHasChecked = false;
    var commentAuthorIsValid = false;
    var commentUrlIsValid = true;
    var commentEmailIsValid = true;
    var authenCodeHasChecked = false;
    var authenCodeIsValid = true;
    var hasLogined = false;
    
    function PostComment() {    
        
        var isValid = true;
        
        if($("#wrapAuthenCode").css("display")=="none"){
            ShowAuthenCode();
            $("#tip_AuthenCode").css("color","red");
            $("#tip_AuthenCode").html("请输入验证码！");
            isValid = false;
        }
        
        if(!hasLogined && !commentAuthorHasChecked){
            CheckAuthor();        
        }                
        if(!hasLogined && !commentAuthorIsValid){
            isValid = false;
        }
                       
        if(!authenCodeHasChecked){
            CheckAuthenCode();            
        }
        if(!authenCodeIsValid){
            isValid = false;
        }
        
        if(!hasLogined && !commentUrlIsValid){            
            isValid = false;
        }        
        if(!commentEmailIsValid){            
            isValid = false;
        }        
        if(!CheckCommentContent()){
            isValid = false;
        }    
        if(!isValid){
            return;
        }

        var content = $("#tbCommentBody").val();
        if(content.length>2000){
            alert("评论内容过长！不允许发布！");
            return;
        }     
        
        if(content.indexOf("　Ｅ　　　　　　　　　Ｅ　　　　　　　　　　Ｅ　　　　　　")>=0){
            alert("该内容不允许布！");
            return;
        }   
        
       if ($("#span_comment_posted").html()!='' && $("#span_comment_posted").html()==content){
            alert("该评论已发表过!");
            return;
        }
        
        $("#tip_comment").html("评论提交中...");
        $("#span_comment_posted").html(content);
        //content = content.replace("'", "\\'");
        var email = $("#tbCommentEmail").val();
        var authenNum = $("#tbAuthenCode").val();
        var authenId = $("#span_comment_test").html();
        var comment = {};
        comment.authenNum = authenNum;
        comment.authenId= authenId;
        comment.parentId = 1743293;
        comment.blogId = 14943;
        comment.sourceUrl = 'http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html';
        comment.author = $("#tbCommentAuthor").val();
        comment.url = $("#tbCommentAuthorUrl").val();
        comment.authenCode = $("#tbAuthenCode").val();
        comment.email = email;
        comment.title = 'C#语法糖（Csharp Syntactic sugar）大汇总';
        comment.content = content;
        comment.parentCommentId = $("#span_parentcomment_id").html();
        $.ajax({
            url: '/ws/CommentService.asmx/AddAnonymousComment',
            data: $.toJSON(comment),
            type: "post",
            dataType: "json",
            contentType: "application/json; charset=utf8",
            success: function(data) {
               if (data.d["IsSuccess"]) {
                    ShowCommentMsg("感谢您的回复:)");
                    //RereshComments2(comment.parentId);
                    $("#tbCommentBody").val('');
                    //$("#divCommentShow").html(data.d["ReturnData"]+content.replace(/\n/g,"<br/>")+"<br/><br/>");
                    $("#divCommentShow").html($("#divCommentShow").html()+data.d["ReturnData"]); 
                    $("#tip_AuthenCode").html('');
                    RefreshAuthenCode();
                    $("#tbAuthenCode").val("");                    
                    CommentNotify(data.d["CommentID"]);
                }
                else {
                    ShowCommentMsg(data.d["ReturnData"]);//"抱歉！评论提交失败！请与管理员联系。");
                    $("#span_comment_posted").html(''); 
                }
            },
            error: function(xhr) {
                ShowCommentMsg("抱歉！评论提交失败！请与管理员联系。");
                $("#span_comment_posted").html('');  
                //alert(xhr.responseText);
            }
        }
        );
    }
    
    function RefreshAuthenCode(){
        AjaxPost("/ws/CommentService.asmx/RefreshAuthenCode","{}",RefreshImg); 
        $("#lnkRereshAuthenCode").html("<span style='color:red'>刷新中...</span>");
        return false;
    }
    
    function RefreshImg(response){
       $("#imgAuthenCode").attr("src","/Modules/CaptchaImage/ValidCodeImage.aspx?id="+encodeURIComponent(response));
       $("#span_comment_test").html(response);
       $("#lnkRereshAuthenCode").html("看不清，换一个");
    }
    
    function ShowAuthenCode(){
        //if($("#wrapAuthenCode").css("display")=="none"){    
        //    AjaxPost("/ws/CommentService.asmx/RefreshAuthenCode","{}",ShowAuthenCodeOk);
        //}
        $("#wrapAuthenCode").show();      
    }
    
    function ShowAuthenCodeOk(response){
         UpdateAuthenCode();
         $("#tbAuthenCode").val("");
         $("#wrapAuthenCode").show();
         $("#tip_AuthenCode").html('');
    }  
 
    
    function CheckAuthor(isOnblur){
        commentAuthorHasChecked = true;
        var maxLength = 30;
        if($("#tbCommentAuthor").val().length == 0){
            $("#tip_author").html("请输入您的昵称！");
            commentAuthorIsValid = false;
            return false;
        }     
        else if($("#tbCommentAuthor").val().length > maxLength){
            $("#tip_author").html("昵称不允许超过" + maxLength + "个字符！");
            commentAuthorIsValid = false;
            return false;
        }
        else{
            //if(isOnblur){
                AjaxPost("/ws/CommentService.asmx/IsAuthorExist","{author:'"+$("#tbCommentAuthor").val()+"'}" ,OnCheckAuthorExist);
            //}
            //else{
            //    $("#tip_author").html("");
            //    commentAuthorIsValid = true;
            //}
            return true;
        }
   }
   
    function OnCheckAuthorExist(response){        
        if(!response){
            $("#tip_author").html("");
            commentAuthorIsValid = true;
        }
        else{
            $("#tip_author").html("该昵称已被使用，请更换昵称");
            commentAuthorIsValid = false;
        }
   }
   
    function CheckUrl(){
        var maxLength = 50;
        var url = $("#tbCommentAuthorUrl").val();
        
        if(url.length == 0){
            commentUrlIsValid = true;
            return true;
        }
        else if(url.length > maxLength){
            $("#tip_url").html("主页地址不允许超过" + maxLength + "个字符！");
            commentUrlIsValid = false;
            return false;
        }
        else if(url.indexOf("http://")!=0 || url.indexOf(".") < 0){
            $("#tip_url").html("主页地址要以“http://”开头");
            commentUrlIsValid = false;
            return false;
        }
        else{
            $("#tip_url").html("");
            commentUrlIsValid = true;
            return true;
        }
   }
   
   function CheckEmail(){
        var email = $("#tbCommentEmail").val();
        if(email.length>0){
            var regExp = new RegExp("\\w+@((\\w|\-)+\\.)+[a-z]{2,3}");
            if(!regExp.test(email)){
                $("#tip_email").html("请输入正确的邮件地址!");
                commentEmailIsValid = false;
            }
            else{
                commentEmailIsValid = true;
                 $("#tip_email").html("");
            }
        }
        else{
            commentEmailIsValid = true;
            $("#tip_email").html("");  
        }
   }
   
   function CheckAuthenCode(){
        authenCodeHasChecked = true;
        var num = $("#tbAuthenCode").val();
        var id = $("#span_comment_test").html();
        $("#tip_AuthenCode").css("color","red");
        if(num.length==0){
             authenCodeIsValid = false;
             $("#tip_AuthenCode").html("请输入验证码！");
             return;
        }
        else if(num.length!=4){
            authenCodeIsValid = false;
            $("#tip_AuthenCode").html("请输入四位数字！");
             return;
        }
        else if(new RegExp("(\d+)").test(num)){
            authenCodeIsValid = false;
            $("#tip_AuthenCode").html("请输入四位数字！");
             return;
        }
        else{
            AjaxPost("/ws/CommentService.asmx/CheckAuthenCode","{number:"+num+",id:'"+id+"'}", OnCheckAuthenCode);
        }
   }
   
   function OnCheckAuthenCode(response){
        if(response){
            $("#tip_AuthenCode").css("color","green");
            $("#tip_AuthenCode").html("验证码输入正确！");
            authenCodeIsValid = true;            
        }
        else{
            $("#tip_AuthenCode").css("color","red");
            $("#tip_AuthenCode").html("验证码输错啦！");
            RefreshAuthenCode();
            authenCodeIsValid = false;           
        }
   }
   
   function CheckCommentContent(){
    if($("#tbCommentBody").val().length==0){
        alert("请输入评论内容！");
        return false;
    }
    return true;
   }
    
</SCRIPT>
<DIV id="ctl05_comment_form" class="commentform">



<DIV id="ctl05_divCommentPannel">
<DIV id="divCommentShow"></DIV>
<DIV id="comment_nav" style="text-align:right"><SPAN id="span_refresh_tips"></SPAN><A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html###" onclick="return RefreshCommentList(1743293);" name="commentform" id="lnk_RefreshComments">刷新评论列表</A>&nbsp; <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html###" onclick="return RefreshPage();">刷新页面</A>&nbsp; <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html#top">返回页首</A></DIV>
<DIV id="commentform_title">发表评论 <SPAN class="ad_commentbox_up"><A href="http://www.cnblogs.com/" target="_blank">博客园首页</A>&nbsp; <A href="http://news.cnblogs.com/" target="_blank">IT新闻</A>&nbsp; <A href="http://home.cnblogs.com/ing/" target="_blank">闪存</A>&nbsp; <A href="http://job.cnblogs.com/" target="_blank">招聘</A>&nbsp; <A href="http://a4.yeshj.com/rd/34143/" target="_blank">学英语</A></SPAN></DIV>
<SPAN id="tip_comment" style="color:Red"></SPAN>
<P>
昵称：<INPUT id="tbCommentAuthor" type="text" class="author" onfocus="ShowAuthenCode()" onblur="CheckAuthor()"> <SPAN id="tip_author" style="color:red"></SPAN><A href="http://passport.cnblogs.com/login.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fyukaizhao%2farchive%2f2010%2f05%2f25%2fcsharp-Syntactic-sugar.html%3flogin%3d1%23commentform">[登录]</A>
<A href="http://passport.cnblogs.com/register.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fyukaizhao%2farchive%2f2010%2f05%2f25%2fcsharp-Syntactic-sugar.html%23Top">[注册]</A>
</P>
<P>
主页：<INPUT id="tbCommentAuthorUrl" type="text" class="url" onfocus="ShowAuthenCode()" onblur="CheckUrl()"> <SPAN id="tip_url" style="color:red"></SPAN>
</P>
<P>
邮箱：<INPUT id="tbCommentEmail" type="text" class="email" onfocus="ShowAuthenCode()" onblur="CheckEmail()">(仅博主可见) <SPAN id="tip_email" style="color:red"></SPAN>
</P>
<P id="wrapAuthenCode" style="display:none">
验证码：<INPUT id="tbAuthenCode" type="text" onblur="CheckAuthenCode()"> <SPAN id="tip_AuthenCode"></SPAN><IMG id="imgAuthenCode" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ValidCodeImage.aspx" alt="验证码" align="absmiddle"> <A href="http://www.cnblogs.com/yukaizhao/archive/2010/05/25/csharp-Syntactic-sugar.html###" onclick="return RefreshAuthenCode();" id="lnkRereshAuthenCode">看不清，换一个</A>
</P>
<P>
评论内容：<SPAN id="tip_comment_content" style="color:Red"></SPAN><BR>
<TEXTAREA id="tbCommentBody" class="comment_textarea" onkeydown="return clt_enter(event)" onfocus="ShowAuthenCode()">
</TEXTAREA>
<!--
<br /><input id="cbRememberMe" type="checkbox" />记住我的昵称和主页
-->
</P>
<P>
<INPUT id="btn_comment_submit" type="button" class="comment_btn" value="提交" onclick="PostComment();return false;">
&nbsp;&nbsp;<A href="http://passport.cnblogs.com/login.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fyukaizhao%2farchive%2f2010%2f05%2f25%2fcsharp-Syntactic-sugar.html%3flogin%3d1%23commentform">登录</A>&nbsp;&nbsp;<A href="http://passport.cnblogs.com/register.aspx?ReturnUrl=http%3a%2f%2fwww.cnblogs.com%2fyukaizhao%2farchive%2f2010%2f05%2f25%2fcsharp-Syntactic-sugar.html%23Bottom">注册</A>
</P>
<P>
[使用Ctrl+Enter键快速提交评论]
</P>
<DIV style="display:none">
<SPAN id="comment_edit_id"></SPAN><SPAN id="span_parentcomment_id">0</SPAN>
<SPAN id="span_parent_id">1743293</SPAN>
<SPAN id="span_comment_replyto"></SPAN>
<SPAN id="span_comment_posted"></SPAN>
<SPAN id="span_comment_test">USArfLmJHTg=</SPAN>
</DIV>
</DIV>


<DIV class="itnews c_ad_block">
<A href="http://news.cnblogs.com/">IT新闻</A>:<BR>

          ·  <A href="http://news.cnblogs.com/n/70590/" target="_blank">Spotify首席设计师10月加盟Facebook</A><BR>
	
          ·  <A href="http://news.cnblogs.com/n/70586/" target="_blank">微软动态类型数据访问程序库简介</A><BR>
	
          ·  <A href="http://news.cnblogs.com/n/70585/" target="_blank">P!=NP证明引发许多疑问</A><BR>
	
          ·  <A href="http://news.cnblogs.com/n/70584/" target="_blank">Google TV 最终版 logo 确定</A><BR>
	
          ·  <A href="http://news.cnblogs.com/n/70583/" target="_blank">智能手机可能很快将取代信用卡</A><BR>
	
<A href="http://news.cnblogs.com/">更多IT新闻...</A>
</DIV>


<DIV class="c_ad_block">
<DIV style="margin-top:5px;">
<SCRIPT type="text/javascript">
    if (c_enable_dfp) {
        try {
            GA_googleFillSlot("cnblogs_blogpost_bottom");
        }
        catch (e) { }
    }
</SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ads"></SCRIPT><DIV id="google_ads_div_cnblogs_blogpost_bottom">
<INS style="width: 300px; height: 250px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: inline-table; position: relative; "><INS style="width: 300px; height: 250px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; position: relative; "><IFRAME id="google_ads_iframe_cnblogs_blogpost_bottom" name="google_ads_iframe_cnblogs_blogpost_bottom" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0px; left: 0px; "></IFRAME></INS></INS></DIV>
<SCRIPT>GA_googleCreateDomIframe('google_ads_div_cnblogs_blogpost_bottom' ,'cnblogs_blogpost_bottom');</SCRIPT>
</DIV>
<DIV class="itnews c_ad_block" id="job_block">
<A href="http://kb.cnblogs.com/" target="_blank" title="程序员知识库"><B>知识库最新文章</B></A>:<BR>
<DIV id="kb_recent">

		<A href="http://kb.cnblogs.com/page/70509/" target="_blank">Windows平台网站文件同步备份解决方案——cwRsyn</A><BR>
	
		<A href="http://kb.cnblogs.com/page/70489/" target="_blank">PetShop之ASP.NET缓存设计</A><BR>
	
		<A href="http://kb.cnblogs.com/page/70534/" target="_blank">Silverlight实例教程 - Out of Browser开篇</A><BR>
	
		<A href="http://kb.cnblogs.com/page/70575/" target="_blank">Silverlight实例教程 - Out of Browser配置,安装和卸载</A><BR>
	
		<A href="http://kb.cnblogs.com/page/70576/" target="_blank">Silverlight实例教程 - Out of Browser的自定义应用</A><BR>
	
</DIV>
</DIV>
</DIV>
<DIV class="c_ad_block">
<A href="http://www.feifanit.com.cn/productFlow.htm" target="_blank"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/e8_net_468x60.gif" alt=""></A>
</DIV>

<DIV id="site_nav_under" class="c_ad_block">
网站导航：<BR>
<A href="http://www.cnblogs.com/" target="_blank">博客园首页</A> &nbsp;<A href="http://news.cnblogs.com/" target="_blank">IT新闻</A> &nbsp;<A href="http://home.cnblogs.com/" target="_blank">个人主页</A> &nbsp;<A href="http://home.cnblogs.com/ing/" target="_blank">闪存</A> &nbsp;<A href="http://job.cnblogs.com/" target="_blank">程序员招聘</A> &nbsp;<A href="http://space.cnblogs.com/" target="_blank">社区</A> &nbsp;<A href="http://space.cnblogs.com/q/" target="_blank">博问</A> 
</DIV>
<DIV id="ad_under_comment2" class="c_ad_block">
<A href="http://www.china-pub.com/STATIC07/1005/zh_loving_100528.asp" target="_blank"><IMG src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/china_pub_20100610.gif" alt="" style="border:0px;"></A><BR>
<A href="http://www.china-pub.com/itbook/" target="_blank">China-pub 计算机图书网上专卖店！6.5万品种2-8折！</A><BR>
<A href="http://www.china-pub.com/static07/0901/zh_jueba_090121.asp" target="_blank">China-Pub 计算机绝版图书按需印刷服务</A><BR>
</DIV>

<DIV id="relative_search"><BR><B>相关搜索:</B><BR> <A href="http://zzk.cnblogs.com/s?w=csharp" target="_blank">csharp</A> <A href="http://zzk.cnblogs.com/s?w=%e8%af%ad%e6%b3%95%e7%b3%96" target="_blank">语法糖</A> <A href="http://zzk.cnblogs.com/s?w=%e5%8c%bf%e5%90%8d%e5%a7%94%e6%89%98" target="_blank">匿名委托</A> <A href="http://zzk.cnblogs.com/s?w=%e6%89%a9%e5%b1%95%e6%96%b9%e6%b3%95" target="_blank">扩展方法</A> <A href="http://zzk.cnblogs.com/s?w=.Net%e5%bc%80%e5%8f%91%e7%bb%8f%e9%aa%8c" target="_blank">.Net开发经验</A> <A href="http://zzk.cnblogs.com/s?w=c%23" target="_blank">c#</A> <A href="http://zzk.cnblogs.com/s?w=%e7%ae%80%e5%8d%95%e9%97%ae%e9%a2%98" target="_blank">简单问题</A> </DIV><DIV id="kb_link"><BR><B>最简洁阅读版式：</B><BR> <A href="http://archive.cnblogs.com/a/1743293/">C#语法糖（Csharp Syntactic sugar）大汇总</A></DIV>





</DIV>


				
	
<!--done-->
<DIV class="footer">
	
	Copyright ©2010 玉开 Powered by: <A href="http://www.cnblogs.com/" class="footerlink">博客园</A> 模板提供：<A href="http://blog.hjenglish.com/" class="footerlink">沪江博客</A><BR>
</DIV>
</DIV>


<SCRIPT>
function addLoadEvent(f) { 
var old = window.onload;
if (typeof old != 'function') window.onload = f;
else { window.onload = function() { old(); f() ;};}
}
function previousElement(o) {
	do{o = o.previousSibling;}while(o && o.nodeType != 1)
	return o;
}
function $t(tag,c,index){
var os = document.getElementsByTagName(tag);
if(!index)index = 0;
if(os && os.length){
	var j = 0;
  for(var i=0;i<os.length;i++){
    if(os[i].className.indexOf(c)>-1){
		if(j == index)
			return os[i];
		j++;
	}
  }
}
return false;
}
</SCRIPT>
<SCRIPT type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ga.js" type="text/javascript"></SCRIPT>
<SCRIPT type="text/javascript">
var pageTracker = _gat._getTracker("UA-883539-3");
pageTracker._initData();
pageTracker._trackPageview();
</SCRIPT>

<SCRIPT>
function getY(o){ var y = 0;
	if(o.offsetParent)while (o.offsetParent) { y += o.offsetTop; o = o.offsetParent; }
	return y;
}
function getX(o){ var x = 0
	if (o.offsetParent) while (o.offsetParent) { x += o.offsetLeft; o = o.offsetParent ;}
	return x;
}
function $id(id){return document.getElementById(id);}
</SCRIPT>
<SCRIPT language="javascript">
        $(function() {
        $("input[name=commentbutton1]").click(function() {
            $("div[class=diggit]").trigger('click');
            $("textarea[class=comment_textarea]").val("此文不错，值得推荐！");
                PostComment();
            });
            $("input[name=commentbutton3]").click(function() {
            $("textarea[class=comment_textarea]").val("继续努力，加油！");
                PostComment();
            });
            $("input[name=commentbutton4]").click(function() {
            $("textarea[class=comment_textarea]").val("不完全赞同，有争议！");
                PostComment();
            });
            $("input[name=commentbutton5]").click(function() {
            $("textarea[class=comment_textarea]").val("不同意楼主观点，拍砖！");
                PostComment();
            });
            $("input[name=commentbutton6]").click(function() {
                $("textarea[class=comment_textarea]").val("飘过~~");
                PostComment();
            });
        });  
    </SCRIPT>
 
    
	<SCRIPT type="text/javascript" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/shCore.js"></SCRIPT>
	<SCRIPT type="text/javascript" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/shLanguage.js"></SCRIPT>
    <SCRIPT type="text/javascript">
        try {
            SyntaxHighlighter.config.clipboardSwf = 'http://common.cnblogs.com/flash/clipboard.swf';
            SyntaxHighlighter.all();
        } catch (e) { }
    </SCRIPT>  
    <SCRIPT type="text/javascript" src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ShowHidden.js"></SCRIPT>
    <SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/stats.aspx" type="text/javascript"></SCRIPT>
    <SCRIPT type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </SCRIPT><SCRIPT src="./C#语法糖（Csharp Syntactic sugar）大汇总 - 欢迎光临赵玉开的技术博客 - 博客园_files/ga.js" type="text/javascript"></SCRIPT>
    <SCRIPT type="text/javascript">
        try {
            var pageTracker = _gat._getTracker("UA-476124-1");
            pageTracker._trackPageview();
        } catch (err) { }</SCRIPT>


</DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></FORM></BODY></HTML>